import cv2
#cap  = cv2.VideoCapture("rtsp://admin:admin123@192.168.1.164:554/h264/ch38/sub/av_stream")
#cap2 = cv2.VideoCapture("rtsp://admin:admin12345@192.168.1.230:554/h264/ch38/sub/av_stream")
cap = cv2.VideoCapture("F:\\py\\camHumDetect\\img\\bd1627e63900eb94db93cab16e0cd5bc.mp4")

fps = cap.get(cv2.CAP_PROP_FPS)  
size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)),   
         int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))  
print(fps)
currentFrame = 0
width = 320
height = 320
cap.set(cv2.CAP_PROP_FRAME_WIDTH, width)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)
while cap.isOpened():
    if(currentFrame % 10 ==0):
       print("go once")
    ret,frame = cap.read()
    frame = cv2.UMat(frame)  
    #imgUMat = cv2.UMat(img) 
    gray_lwpCV = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 
    #gray_lwpCV = cv2.GaussianBlur(gray_lwpCV, (21, 21), 0) 

    currentFrame+=1
    cv2.imshow("frame",gray_lwpCV)
    cv2.waitKey(1) #延迟  
#     # ret2,frame2 = cap2.read()
#     # cv2.imshow("frame2",frame2)
#     # cv2.waitKey(1)

